Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Straight CorridorGeometry. #2513

Merged
merged 5 commits into from
Feb 27, 2015
Merged

Straight CorridorGeometry. #2513

merged 5 commits into from
Feb 27, 2015

Conversation

bagnell
Copy link
Contributor

@bagnell bagnell commented Feb 25, 2015

Fixes #2511 and also the same problem that was occurring for PolylineVolumeGeometry.

@mramato
Copy link
Contributor

mramato commented Feb 25, 2015

Anyway we can unit test this?

@WarpDrive
Copy link

What about straight lines that aren't parallel to lines of longitude or latitude, like this case

var viewer = new Cesium.Viewer('cesiumContainer', { infoBox : false });
var entities = viewer.entities;

entities.add({
    corridor : {
        positions : Cesium.Cartesian3.fromDegreesArray([
-90,30, /*45 deg 100km*/
-89.260833,30.633889, /*45.373056 deg 100km*/
-88.511944,31.263611, /*45.758056 deg 100km*/
-87.753056,31.888889, /*46.155278 deg 100km*/
-86.983889,32.509444, /*46.565 deg 100km*/
        ]),
        width : 40000,
        height : 0,
        outline : true,
        outlineColor : Cesium.Color.WHITE,
        outlineWidth : 4,
        material : Cesium.Color.fromRandom({alpha : 0.7})
    }
});

viewer.zoomTo(viewer.entities);

Change width to 400 and it's straight as an arrow, but it is crooked when it's 40000.

I generated these series of points using
http://www.movable-type.co.uk/scripts/latlong.html
Destination point given distance and bearing from start point

And converted to decimal degrees using
http://www.fcc.gov/encyclopedia/degrees-minutes-seconds-tofrom-decimal-degrees

@bagnell
Copy link
Contributor Author

bagnell commented Feb 27, 2015

Thanks @slysnake, I switched back to my first solution which is check the angle between the direction vectors projected onto the tangent plane. The first time I forgot to re-normalize.

@mramato I added tests. This is ready for another review.

@WarpDrive
Copy link

You're welcome, I'm glad I could help. Though I haven't really studied the code much to see how it all works. It's strange that narrow widths are straight, but not wide widths. I thought widths wouldn't affect the path.

@pjcozzi
Copy link
Contributor

pjcozzi commented Feb 27, 2015

Update CHANGES.md.

Can we merge this today so it makes 1.7?

@mramato
Copy link
Contributor

mramato commented Feb 27, 2015

Tests pass, example code in the linked issue is clearly fixed in this branch (and broken in master). I updated CHANGES.

mramato added a commit that referenced this pull request Feb 27, 2015
@mramato mramato merged commit a611d1e into master Feb 27, 2015
@mramato mramato deleted the corridor branch February 27, 2015 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect straight CorridorGeometry
4 participants